﻿<Page
    x:Name="pageRoot"
    x:Class="Atletika.ArticleDetailPage"
    DataContext="{Binding Path=DefaultViewModel.Item, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Atletika"
    xmlns:common="using:Atletika.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <DataTemplate x:Key="ArticleDetailTemplate">
            <ScrollViewer VerticalScrollBarVisibility="Auto" Padding="50 0">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Image Grid.Row="0" Source="{Binding FullImagePath}" Width="500" />
                    <TextBlock Grid.Row="1" Style="{StaticResource TitleTextBlockStyle}" Text="{Binding PublishInfo}" 
                                   Margin="0,10,0,0" TextWrapping="Wrap"/>
                    <TextBlock Grid.Row="2" Style="{StaticResource SubheaderTextBlockStyle}" Text="{Binding Title}" 
                                   Margin="0,10,0,0" TextWrapping="Wrap"/>
                    <TextBlock Grid.Row="3" Style="{StaticResource TitleTextBlockStyle}" Text="{Binding Perex}"
                                   Margin="0,10,0,0" TextWrapping="Wrap"/>
                    <TextBlock Grid.Row="4" Style="{StaticResource BodyTextBlockStyle}" Text="{Binding Text}" 
                           Margin="0,10,0,50" TextWrapping="Wrap" />
                </Grid>
            </ScrollViewer>
        </DataTemplate>
    </Page.Resources>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="1" x:Name="contentRegion"/>

        <!-- Title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="pageTitle" Text="{Binding Title}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
        </Grid>
        
        <!-- Content -->
        <ContentControl Grid.Row="1" Grid.ColumnSpan="2" ContentTemplate="{StaticResource ArticleDetailTemplate}"/>
    </Grid>
</Page>
